﻿using Cherry.Agile.Enterprise.Entity;
using Cherry.Agile.Enterprise.Entity.Enum;
using Cherry.Agile.Mvc;
using Cherry.Agile.UI.Framework.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Cherry.Agile.Web.Areas.Admin.Controllers
{
    public class DefaultController : BaseController
    {
        // GET: Admin/Default
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Menu()
        {
            //this.CurrentUser.ID

            return PartialView(GetMenuInfos());
            
        }


        private IList<MenuInfo> GetMenuInfos()
        {
            IList<MenuInfo> menus = new List<MenuInfo>();
            menus.Add( new MenuInfo()
            {
                 MenuID = 10101,
                 MenuName = "文字排版",
                 ParentID = DefaultData.USER_MENU_ROOT,
                 MenuURL = "xxxx",
                 MenuIcon = "icon-text-width"
            });

            menus.Add(new MenuInfo()
            {
                MenuID = 10102,
                MenuName = "UI 组件",
                ParentID = DefaultData.USER_MENU_ROOT,
                MenuURL = "xxxx",
                MenuIcon = "icon-desktop"
            });

            menus.Add(new MenuInfo()
            {
                MenuID = 101021,
                MenuName = "组件",
                ParentID = 10102,
                MenuURL = "xxxx",
                MenuIcon = "icon-double-angle-right"
            });

            menus.Add(new MenuInfo()
            {
                MenuID = 101022,
                MenuName = "按钮 &amp; 图表",
                ParentID = 10102,
                MenuURL = "xxxx",
                MenuIcon = "icon-double-angle-right"
            });

            menus.Add(new MenuInfo()
            {
                MenuID = 101023,
                MenuName = "三级菜单",
                ParentID = 10102,
                MenuURL = "xxxx",
                MenuIcon = "icon-double-angle-right"
            });
            menus.Add(new MenuInfo()
            {
                MenuID = 1010231,
                MenuName = "第一级",
                ParentID = 101023,
                MenuURL = "xxxx",
                MenuIcon = "icon-leaf"
            });
            menus.Add(new MenuInfo()
            {
                MenuID = 1010232,
                MenuName = "第四级",
                ParentID = 101023,
                MenuURL = "xxxx",
                MenuIcon = "icon-pencil"
            });

            menus.Add(new MenuInfo()
            {
                MenuID = 10102321,
                MenuName = "添加产品",
                ParentID = 1010232,
                MenuURL = "xxxx",
                MenuIcon = "icon-plus"
            });

            menus.Add(new MenuInfo()
            {
                MenuID = 10102322,
                MenuName = "查看商品",
                ParentID = 1010232,
                MenuURL = "xxxx",
                MenuIcon = "icon-eye-open"
            });
            return menus;
        }

        [AuthorizeIgnore]
        public ActionResult SignOut()
        {
            //Cherry.Agile.UI.Framework.Security.AuthorizationManager.SignOut();
            return RedirectToAction("Login", "Auth");
        }
    }
}